import request from '@/utils/request'

/**
 * 获取概览统计数据
 * @param {String} timeRange - 时间范围：TODAY, WEEK, MONTH, YEAR
 */
export function getOverviewStatistics(timeRange = 'WEEK') {
  return request({
    url: '/statistics/overview',
    method: 'get',
    params: { timeRange }
  })
}

/**
 * 获取订单趋势数据
 * @param {String} timeRange - 时间范围：TODAY, WEEK, MONTH, YEAR
 */
export function getOrderTrend(timeRange = 'WEEK') {
  return request({
    url: '/statistics/order-trend',
    method: 'get',
    params: { timeRange }
  })
}

/**
 * 获取销售趋势数据
 * @param {String} timeRange - 时间范围：TODAY, WEEK, MONTH, YEAR
 */
export function getSalesTrend(timeRange = 'WEEK') {
  return request({
    url: '/statistics/sales-trend',
    method: 'get',
    params: { timeRange }
  })
}

/**
 * 获取分类销售分布
 * @param {String} timeRange - 时间范围：TODAY, WEEK, MONTH, YEAR
 */
export function getCategoryDistribution(timeRange = 'WEEK') {
  return request({
    url: '/statistics/category-distribution',
    method: 'get',
    params: { timeRange }
  })
}

/**
 * 获取商品销售排行
 * @param {String} timeRange - 时间范围：TODAY, WEEK, MONTH, YEAR
 * @param {Number} limit - 查询数量限制
 */
export function getTopProducts(timeRange = 'WEEK', limit = 10) {
  return request({
    url: '/statistics/top-products',
    method: 'get',
    params: { timeRange, limit }
  })
}

